/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.scene.utils;


public enum BusinessCode {

    SUCCESS(0, "操作成功"),
    FAILURE(-1, "操作失败"),
    EXCEPTION(-2, "执行过程中发生异常"),
    CHECK_CANNOT_REMOVE(101001, "检查记录已提交不能删除"),
    DEVICE_NAME_DUP(102001, "同一网格下的设备名称重复"),
    CHECK_TITLE_DUP(102002, "检查记录标题重复"),
    CHECK_CANNOT_UPDATE(102003, "检查记录已提交不能再修改"),
    NO_LOGIN(10000, "用户未登陆"),
    INSUFFICIENT_PARAM(102005, "缺少必要的参数"),
    HIDDENDANGER_CANNOT_EDIT(102006, "隐患不存在或非草稿状态不能修改"),
    NO_CHECK_RECORD(102007, "检查记录不存在"),
    CHECK_CANNOT_COMMIT(102008, "检查记录不能重复提交"),
    CALIBRATION_TITLE_DUP(102009, "设备校验标题重复"),
    CALIBRATION_CANNOT_UPDATE(102010, "检验记录已提交不能再修改"),
    SAME_ENTERPRISE_NAME(102011, "企业名称不能重复"),
    JSATEMPLATE_NAME_DUP(102012, "JSA模板名称重复"),
    PROJECT_NAME_CANNOT_DUP(102013, "项目名称已存在，请重新输入！"),
    PROJECT_NAME_CANNOT_EMPTY(102014, "项目名称不能为空"),
    PROJECT_TYPE_CANNOT_EMPTY(102015, "项目类型不能为空"),
    PROJECT_CORP_CANNOT_EMPTY(102016, "项目单位不能为空"),
    PROJECT_LEADER_CANNOT_EMPTY(102017, "项目负责人不能为空"),
    PROJECT_STATE_CANNOT_EMPTY(102018, "项目状态不能为空"),
    PROJECT_ESTABLISHDATE_CANNOT_EMPTY(102019, "项目立项日期不能为空"),
    PROJECT_ENTERPRISE_CANNOT_EMPTY(102020, "项目相关方id不能为空"),
    PROJECT_MAINTAIN_STAFF_CANNOT_EMPTY(102021, "项目维护人员不能为空"),
    PROJECT_MAINTAIN_ENTERPRISE_CANNOT_EMPTY(102022, "项目维护相关方不能为空"),
    PROJECT_NOT_EXIST(102023, "项目维护相关方不能为空"),
    JSAINSTANCE_NAME_DUP(102024, "水司JSA名称重复"),
    SITEACTIVITY_NAME_DUP(102025, "水司作业活动名称重复"),
    ACTIVITYSTAGE_NAME_DUP(102026, "作业活动分解步骤名称重复"),
    PROJECT_CERTIFICATE_NOT_EXIST(102027, "人员证照不存在"),
    TRAINING_CANNOT_EMPTY(102028, "培训不能为空"),
    TRAINING_STAFF_NAME_CANNOT_EMPTY(102029, "培训人名称不能为空"),
    TRAINING_ID_CARD_CANNOT_EMPTY(102030, "培训人身份证不能为空"),
    TRAINING_NAME_CANNOT_EMPTY(102031, "培训课程不能为空"),
    TRAINING_TIME_CANNOT_EMPTY(102032, "培训时间不能为空"),
    DAMAGEEXAMINATION_NAME_DUP(102033, "危害因素检测名称相同"),
    HEALTH_DOCUMENTATION_NAME_DUP(102034, "职业健康档案名称相同"),

    PROJECT_FILE_NAME_CANNOT_EMPTY(102035, "相关方文件名称不能为空"),
    PROJECT_FILE_TYPE_CANNOT_EMPTY(102036, "相关方文件类型不能为空"),
    ASSESSMENT_NOT_EXIST(102037, "考核记录不存在"),
    ASSESSMENT_SCORE_NOT_EXIST(102038, "考核得分记录不存在"),
    ASSESSMENT_STAFF_CANNOT_EMPTY(102039, "考核人员不能为空"),
    HAVE_NO_RIGHT_ASSESSMENT(102040, "没有该考核的权限"),
    ASSESSMENT_SCORE_CANNOT_EMPTY(102041, "考核评分不能为空"),
    ASSESSMENT_TYPE_ERROR(102042, "考核类型异常"),
    SITEACTIVITY_QUERY(102043, "该水司作业活动已失效，请刷新页面"),
    SITEACTIVITY_STATUS_UPDATE(102044, "只能修改草稿状态的水司作业活动"),
    SITEACTIVITY_STATUS_DELETE(102045, "只能删除草稿状态的水司作业活动"),
    MESSAGE_CODE_FLOW_EXCEPTION(102046, "流程启动失败"),

    PROJECT_EXIST_ENTERPRISE(102047, "请先解除项目与相关方关联关系"),
    ENTERPRISE_EXIST_PROJECT(102047, "请先解除相关方与项目的关联关系"),
    TASK_NOT_EXIST(102048, "该工作任务已失效，请刷新页面"),

    HANDOVER_NOT_EMPTY(102049, "交班人不能为空"),
    RECEIVER_NOT_EMPTY(102050, "接班人不能为空"),
    DUTYTEAM_NOT_EMPTY(102051, "值班组不能为空"),
    DUTYTEAMUSER_NOT_EMPTY(102052, "值班组成员不能为空"),
    HANDOVEREXPLAIN_NOT_EMPTY(102053, "交接说明不能为空"),
    HIDDENDANGERRECTIFICATION_NOT_EMPTY(102054, "隐患整改信息不能为空"),
    TEAMHANDOVE_NOT_EXIST(102055, "班组交接信息不存在"),
    PRE_SHIFT_MEETING_NOT_EXIST(102056, "班前会不存在"),
    NON_DRAFT_CANNOT_EDIT(102057, "非草稿状态不能修改"),
    NON_DRAFT_CANNOT_DELETE(102058, "非草稿状态不能删除"),
    PRE_SHIFT_MEETING_NOT_SIGN_IN(102059, "您不是该班前会成员，无需签到"),
    PRE_SHIFT_MEETING_SIGN_IN_FAILURE(102060, "签到失败,该班前会班组成员中未找到您的信息"),
    PRE_SHIFT_MEETING_SIGN_EXIST(102060, "您已经完成签到，无需重复签到"),
    PROJECT_NAME_NOT_EMPTY(102061, "工程名称不能为空"),
    SAFETY_INSPECTION_NOT_EXIST(102062, "安全巡查日志不存在"),
    REVIEW_DATE_BEFORE_INSPECT_DATE(102069, "审阅日期不能小于巡查日期"),
    INSPECTOR_NOT_EMPTY(102063, "检查人不能为空"),
    INSPECTED_UNIT_NOT_EMPTY(102064, "被检查单位不能为空"),
    SAFETY_CHECK_NOT_EXIST(102065, "安全检查不存在"),
    DANGEROUS_OPERATION_NOT_EXIST(102066, "危险作业不存在"),
    DELAY_DATE_BEFORE_END_TIME(102067, "延期时间不能小于原定结束时间"),
    FILE_IS_EMPTY(102068, "导入文件为空"),
    CHECKRECORD_EMPTY_CHANGE_FILE(410052,"未选中文件"),
    ;

    private final int code;
    private final String description;

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    BusinessCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static BusinessCode valueOf(int value) {
        return switch (value) {
            case 0 -> SUCCESS;
            case -1 -> FAILURE;
            case -2 -> EXCEPTION;
            case 101001 -> CHECK_CANNOT_REMOVE;
            case 102001 -> DEVICE_NAME_DUP;
            case 102002 -> CHECK_TITLE_DUP;
            case 102003 -> CHECK_CANNOT_UPDATE;
            case 102004 -> NO_LOGIN;
            case 102005 -> INSUFFICIENT_PARAM;
            case 102006 -> HIDDENDANGER_CANNOT_EDIT;
            case 102007 -> NO_CHECK_RECORD;
            case 102008 -> CHECK_CANNOT_COMMIT;
            case 102009 -> CALIBRATION_TITLE_DUP;
            case 102010 -> CALIBRATION_CANNOT_UPDATE;
            case 102011 -> SAME_ENTERPRISE_NAME;
            case 102012 -> JSATEMPLATE_NAME_DUP;
            case 102024 -> JSAINSTANCE_NAME_DUP;
            case 102025 -> SITEACTIVITY_NAME_DUP;
            case 102026 -> ACTIVITYSTAGE_NAME_DUP;
            case 102033 -> DAMAGEEXAMINATION_NAME_DUP;
            case 102034 -> HEALTH_DOCUMENTATION_NAME_DUP;
            case 102035 -> SITEACTIVITY_QUERY;
            case 102036 -> SITEACTIVITY_STATUS_UPDATE;
            case 102037 -> SITEACTIVITY_STATUS_DELETE;
            case 102038 -> MESSAGE_CODE_FLOW_EXCEPTION;
            case 102048 -> TASK_NOT_EXIST;
            case 102049 -> HANDOVER_NOT_EMPTY;
            case 102050 -> RECEIVER_NOT_EMPTY;
            case 102051 -> DUTYTEAM_NOT_EMPTY;
            case 102052 -> DUTYTEAMUSER_NOT_EMPTY;
            case 102053 -> HANDOVEREXPLAIN_NOT_EMPTY;
            case 102054 -> HIDDENDANGERRECTIFICATION_NOT_EMPTY;
            case 102055 -> TEAMHANDOVE_NOT_EXIST;
            case 102056 -> PRE_SHIFT_MEETING_NOT_EXIST;
            case 102057 -> NON_DRAFT_CANNOT_EDIT;
            case 102058 -> NON_DRAFT_CANNOT_DELETE;
            case 102059 -> PRE_SHIFT_MEETING_NOT_SIGN_IN;
            case 102060 -> PRE_SHIFT_MEETING_SIGN_IN_FAILURE;
            case 102061 -> PROJECT_NAME_NOT_EMPTY;
            case 102062 -> SAFETY_INSPECTION_NOT_EXIST;
            case 102063 -> INSPECTOR_NOT_EMPTY;
            case 102064 -> INSPECTED_UNIT_NOT_EMPTY;
            case 102065 -> SAFETY_CHECK_NOT_EXIST;
            case 102066 -> DANGEROUS_OPERATION_NOT_EXIST;
            case 102067 -> DELAY_DATE_BEFORE_END_TIME;
            default -> null;
        };
    }

}
